$(function() {
	$('#vue_vm_list div').hide();
});

var mealCard = {
	mealCardId: '',
	cardPersonId: '',
	cardPersonName: '',
	cardCardId: '',
	walletBalance: '',
	cardType: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	userRfidCardId: '',
};

var view = {
	data: mealCard
};

function recharge() {
	var cardPersonId = $('#cardPersonId').val();
	var money = parseFloat($('#money').val());
	var payWay = parseInt($('input:radio[name="payWay"]:checked').val());
	
	if(!cardPersonId || cardPersonId=='') {
		alert('请选择长者钱包');
		return;
	}
	
	if(!money || money==0) {
		alert('请输入充值金额');
		return;
	}
	
	if(!payWay || payWay==0) {
		alert('请选择充值方式');
		return;
	}
	
	if(confirm('确定充值' + money + '元吗？')) {
		save_basic_by_json(path+'/mealCard/recharge', {cardPersonId:cardPersonId, money:money,
		payType:payWay, updateId:view.data.updateId}, function(response) {
			alert('充值成功');
			var pageParam = response.data[0];
			pageParam.payWay = payWay;
			document.location.href = '9-2-2fangkaadd-1.html?pageParam='+encodeURIComponent(JSON.stringify(pageParam));
		});
	}
}

function deleteBatch() {
	deleteBatch_basic(path+'/mealCard/deleteBatch');
}
